package licode.unisop.provider.vo;

import lombok.*;

import java.util.List;

/**
 * 定义资源信息（仅仅保存资源ID）
 *
 * @author licode
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
public class SiIdAsset {
    /**
     * 资源ID
     */
    private String id;

    /**
     * 资源编码
     */
    private String code;

    /**
     * 父资源ID
     */
    private String parent;

    /**
     * 领域ID
     */
    private String realmId;

    /**
     * 平台标识
     */
    private String platformId;

    /**
     * 子资源集合
     */
    @Getter
    private List<SiIdAsset> children;

    public boolean hasChildren() {
        return (null != children && !children.isEmpty());
    }

    public static SiIdAsset builder() {
        return new SiIdAsset();
    }

    public SiIdAsset build() {
        return this;
    }

    public SiIdAsset realmId(String realmId) {
        setRealmId(realmId);
        return this;
    }

    public SiIdAsset platformId(String platformId) {
        setPlatformId(platformId);
        return this;
    }

    public SiIdAsset id(String id) {
        setId(id);
        return this;
    }

    public SiIdAsset code(String code) {
        setCode(code);
        return this;
    }
}
